<template>
  <van-nav-bar :title="title" class="nav-bar" fixed>
    <van-icon size="22" name="/img/48.png" slot="left" @click="goBack" />
    <div slot="right">
      <slot name="screen"></slot>
    </div>
  </van-nav-bar>
</template>

<script>
import { NavBar, Icon } from "vant";
Vue.use(NavBar).use(Icon);
export default {
  name: "navBar",
  props: {
    title: {
      type: String,
      default: "标题"
    }
  },
  methods: {
    goBack() {
      window.history.length > 1 ? this.$router.go(-1) : this.$router.push("/");
    }
  }
};
</script>
<style lang="less" scoped>
.nav-bar {
  height: 50px;
  width: 100%;
  background-color: #fff;
  .van-nav-bar__title {
    font-size: 16px;
    font-family: PingFangSC-Medium;
    font-weight: 600;
    color: rgba(48, 48, 48, 1);
  }
}
</style>



